<template>
    <div class="app-container">
      <el-form :model="queryParams" ref="queryForm" :inline="true">
        <el-form-item label="学号" prop="studentId">
          <el-input
            v-model="queryParams.studentId"
            placeholder="请输入学号"
            clearable
            size="small"
            style="width: 240px"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="学生姓名" prop="studentName">
          <el-input
            v-model="queryParams.studentName"
            placeholder="请输入学生姓名"
            clearable
            size="small"
            style="width: 240px"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            icon="el-icon-search"
            size="mini"
            @click="handleQuery"
            >搜索</el-button
          >
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
            >重置</el-button
          >
        </el-form-item>
      </el-form>
  
      <el-table v-loading="loading" :data="dataList">
        <el-table-column prop="id" align="center" v-if="false" />
        <el-table-column label="学号" prop="studentId" align="center" />
        <el-table-column label="学生姓名" prop="studentName" align="center" />
        <el-table-column label="学生班级" prop="studentClass" align="center" />
        <el-table-column label="通话开始时间" prop="callStartTime" align="center" >
            <template slot-scope="scope">
            <span>{{ parseTime(scope.row.callStartTime) }}</span>
            </template>
        </el-table-column>    
        <el-table-column label="通话时长" prop="callDuration" align="center" />
        <el-table-column label="剩余时长" prop="remainingDuration" align="center" />
      </el-table>
  
      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </div>
  </template>
  
  <script>
  import { pageList } from "@/api/publicPhone/callRecords";
  export default {
    name: "callRecords",
  
    data() {
      return {
        // 遮罩层
        loading: false,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 总条数
        total: 0,
        // 弹出层标题
        title: "",
        //表格数据
        dataList: [],
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          studentId: undefined,
          studentName: undefined
        },
        formData: {

        },
        importVisible:false,
        importLoading:false
      };
    },
  
    created() {
      this.getList();
    },
  
    methods: {
      getList() {
        this.loading = true;
        pageList(this.queryParams)
          .then((response) => {
            this.dataList = response.data.list;
            this.total = response.data.total;
            this.loading = false;
          })
          .catch((res) => {
            this.loading = false;
          });
      },
  
      /** 重置表单 */
      reset() {
        this.appVersionForm = {
          studentId: undefined,
          studentName: undefined
        };
        this.resetForm("appVersionForm");
      },
  
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
  
      /** 重置查询 */
      resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
      },

    },
  };
  </script>